<?PHP

	class tpl_groupsettings {
		
		public static function groupmembers(){
		
			$members_html = '';
			if(empty($GLOBALS['OUTPUT']->members)){
				$members_html .= <<<EOV
<tr>
	<td class='td2' colspan='3' style='text-align: center; font-style: italic'>{$GLOBALS['LANG']->lang_admin->group_has_no_users}</td>
</tr>
EOV;
			}else{
				$class = 'td1';
				foreach($GLOBALS['OUTPUT']->members as $user){
					$class = ($class == 'td1' ? 'td2' : 'td1');
					
					$members_html .= <<<EOV
	<tr>
		<td class='{$class}'>{$user->data_cache['name']}</td>
		<td class='{$class}'><a href='./index.php?act=admin&page=edituser&uid={$user->data_cache['uid']}{$GLOBALS['OUTPUT']->ses}'>[{$GLOBALS['LANG']->lang_admin->edit}]</a> <a href='./index.php?act=admin&page=edituser&uid={$user->data_cache['uid']}{$GLOBALS['OUTPUT']->ses}&section=userpermissions'>[{$GLOBALS['LANG']->lang_admin->permissions}]</a></td>
		<td class='{$class}' style='text-align: right'><input type='checkbox' name='user_{$user->data_cache['uid']}' value='{$user->data_cache['uid']}' /></td>
	</tr>
EOV;
				}
			}
			
				$pages = '';
			for($curpage = 1; $curpage <= $GLOBALS['OUTPUT']->pages; $curpage++){
				$default = ($curpage == $GLOBALS['OUTPUT']->page) ? " selected='true'" : '';
				
				$pages .= <<<EOV
<option$default onclick="document.location='./index.php?act=admin&page=editgroup&section=groupmembers{$GLOBALS['OUTPUT']->ses}&pager={$curpage}&gid={$GLOBALS['OUTPUT']->gid}'">{$curpage}</option>
EOV;
			}
			
			return	tpl_globals::header() .
				<<<EOV
	<script language='javascript' type='text/javascript'>
		var allChecked = false;
		function checkAll(){
			
			for(key in document.forms[0].elements){
				document.forms[0].elements[key].checked = !allChecked;
			}
			allChecked = !allChecked;
			
		}
		
	</script>
	
	<form name='checkbox_form' action='./index.php?act=admin&page=editgroup&section=groupmembers&gid={$GLOBALS['OUTPUT']->gid}{$GLOBALS['OUTPUT']->ses}&exec=change' method='post'>

		<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->groupmembers}</div>
		<table style='width: 100%;' cellspacing='1' cellpadding='5'>
			<tr>
				<td class='table_header_row' width='40%'>{$GLOBALS['LANG']->lang_admin->username}</td>
				<td class='table_header_row' width='30%'>{$GLOBALS['LANG']->lang_admin->action}</td>
				<td class='table_header_row' width='10%' style='text-align: right'><input type='checkbox' onclick='checkAll();' value='null' /></td>
			</tr>
			{$members_html}
			<tr>
				<td class='table_header_row' width='100%' colspan='3'>
					{$GLOBALS['LANG']->lang_admin->page}: &nbsp;
					<select style='width: 60px;'>
						{$pages}
					</select>
				</td>
			</tr>
		</table>
		
		<br />
		
		<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->change_group}</div>
		<table style='width: 100%;' cellspacing='1' cellpadding='5'>
			<tr>
				<td class='td2' width='50%'>
					{$GLOBALS['LANG']->lang_admin->group}
					<div class='instructions'>{$GLOBALS['LANG']->lang_admin->chgrp_desc}</div>
				</td>
				<td class='td2'>
EOV
.
					tpl_form::select('group',$GLOBALS['OUTPUT']->groups) .
					<<<EOV
				</td>
			</tr>
			<tr>
				<td class='table_header_row' colspan='2'><input class='form_button_norm' onmouseout="this.className=this.className.replace('_over','_norm');" onmouseover="this.className=this.className.replace('_norm','_over');" type='submit' value='{$GLOBALS['LANG']->lang_formcommon->submit}' /></td>
			</tr>
		</table>
	
	</form>
EOV
.
			tpl_globals::footer();
				
		}
		
		public static function groupsettings(){
		
			return	tpl_globals::header() .
				<<<EOV
	<form action='./index.php?act=admin{$GLOBALS['OUTPUT']->ses}&page=editgroup&section=groupsettings&gid={$GLOBALS['OUTPUT']->gid}' method='post'>
	
	<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->editgroup}</div>
	<table style='width: 100%;' cellspacing='1' cellpadding='5'>
		{$GLOBALS['OUTPUT']->form}
		<tr>
			<td class='table_header_row' colspan='2'><input class='form_button_norm' onmouseout="this.className=this.className.replace('_over','_norm');" onmouseover="this.className=this.className.replace('_norm','_over');" type='submit' value='{$GLOBALS['LANG']->lang_formcommon->submit}' /></td>
		</tr>
	</table>
	
	</form>
EOV
.
			tpl_globals::footer();
				
		}
		
		public static function grouppermissions(){
		
			$form_html = '';
			foreach($GLOBALS['OUTPUT']->forms as $label=>$fields){
				
				$form_html .= <<<EOV
<div class='table_header'>&nbsp;{$label}</div>
<table style='width: 100%;' cellspacing='1' cellpadding='5'>
	{$fields}
</table>

<br />
EOV;
			}
			
			return	tpl_globals::header() .
				<<<EOV
<form action='./index.php?act=admin{$GLOBALS['OUTPUT']->ses}&page=editgroup&section=grouppermissions&update=1&gid={$GLOBALS['OUTPUT']->gid}' method='post'>
	{$form_html}
	<table style='width: 100%;' cellspacing='1' cellpadding='5'>
		<tr>
			<td class='table_header_row' style='text-align: center'><input class='form_button_norm' onmouseout="this.className=this.className.replace('_over','_norm');" onmouseover="this.className=this.className.replace('_norm','_over');" type='submit' value='{$GLOBALS['LANG']->lang_formcommon->submit}' /></td>
		</tr>
	</table>
</form>
EOV
.
			tpl_globals::footer();
				
		}
		
	}

?>